package com.example.helloandroid;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class Twitter extends Activity {
	WebView engine; 
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
	    if (keyCode == KeyEvent.KEYCODE_BACK) {
	    	if (engine.canGoBack()){
	    		engine.goBack();
	    		return true;
	        }
	    }
	    return super.onKeyDown(keyCode, event);
	}
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main2);
        engine = (WebView) findViewById(R.id.web_engine);
        engine.getSettings().setJavaScriptEnabled(true);
		engine.loadUrl("http://twitter.com/#!/MacMSA");
		engine.setWebViewClient(new HelloWebViewClient());
    }
	private class HelloWebViewClient extends WebViewClient {
	    @Override
	    public boolean shouldOverrideUrlLoading(WebView view, String url) {
	        view.loadUrl(url);
	        return true;
	    }
	}
}


